<!DOCTYPE>
<html>
<meta name="csrf-token" content="{{ csrf_token() }}">
@include('common/head');
<body>
<!--header-->
@include('common/navbar')
<!-- header end -->

<div class="page-container">
  <div class="page-content" id="mainContents">
    <div class="container-fluid">
      <div class="row-fluid clearfix"> 
        <!-- BEGIN STYLE CUSTOMIZER -->
        <div class="span12">
          <h3 class="page-title">&nbsp; </h3>
        </div>
        <!-- END PAGE TITLE & BREADCRUMB--> 
      </div>
      <div class="row-fluid">
        <div class="tabbable tabbable-custom tabbable-full-width">
          <ul class="nav nav-tabs">
            <li class="active"><a data-toggle="tab" href="#tab_1_12">危化品新增</a></li>
          </ul>
          <div class="form-content"> 
            <!---->
            <div class="row-fluid margin-bottom-25">
              <div class="span12"> 
                <!-- BEGIN VALIDATION STATES-->
                <div class="portlet box gdcdc">
                	<form action="#" id="form_weiadd" class="form-horizontal">
                		<div class="tip-error j-addtip hide">
							
						</div>
                		<div class="row-fluid clearfix">
		                    <div class="span12"> 
		                      <!--基本信息-->
		                      <div class="detail-item-left weipin-mrgt">
		                        <ul class="breadcrumb clearfix">
		                          <li><a href="javascript:;">基本信息</a></li>
		                        </ul>
		                        <div class="detal-form form-horizontal"> 
		                          <!--start-->
		                          <div class="row-fluid clearfix">
		                            <div class="span10"> 
		                              <!--st-->
		                              <div class="row-fluid clearfix">
		                                <div class="span4">
		                                  <div class="control-group">
		                                    <label class="control-label">西陇名称<span class="required">*：</span></label>
		                                    <div class="controls">					
												<input type="text" class="span12 m-wrap c-xilongname" autocomplete="off" name="Goods[xl_name]"  placeholder="请输入西陇名称">
											</div>	
		                                  </div>
		                                </div>
		                                <div class="span4">
		                                  <div class="control-group">
		                                    <label class="control-label">CAS号<span class="required">*：</span></label>
		                                    <div class="controls">					
												<input type="text" class="span12 m-wrap c-casname" autocomplete="off" name="Goods[cas]"  placeholder="请输入CAS号">
											</div>	
		                                  </div>
		                                </div>
		                                <div class="span4">
		                                  <div class="control-group">
		                                    <label class="control-label">分子式：</label>
		                                    <div class="controls">					
												<input type="text" class="span12 m-wrap c-culareng" autocomplete="off" name="Goods[molecule]"  placeholder="请输入分子式">
											</div>	
		                                  </div>
		                                </div>
		                              </div>
		                              <!--end-->
		                              
		                              <div class="row-fluid clearfix">
		                                <div class="span4">
		                                  <div class="control-group">
		                                    <label class="control-label">中文名称<span class="required">*：</span></label>
		                                    <div class="controls">					
												<input type="text" class="span12 m-wrap c-chinaname" autocomplete="off" name="Goods[zh_name]"  placeholder="请输入中文名称">
											</div>	
		                                  </div>
		                                </div>
		                                <div class="span4">
		                                  <div class="control-group">
		                                    <label class="control-label">EINECS号：</label>
		                                    <div class="controls">					
												<input type="text" class="span12 m-wrap c-einecs" autocomplete="off" name="Goods[einecs]"  placeholder="请输入EINECS号">
											</div>	
		                                  </div>
		                                </div>
		                                <div class="span4">
		                                  <div class="control-group">
		                                    <label class="control-label">分子量：</label>
		                                    <div class="controls">					
												<input type="text" class="span12 m-wrap c-molwt" autocomplete="off"   name="Goods[molecule_num]"  placeholder="请输入分子量">
											</div>	
		                                  </div>
		                                </div>

		                              </div>
		                              <div class="row-fluid clearfix">
		                                <div class="span12">
		                                  <div class="control-group">
		                                    <label class="control-label">别名：</label>
		                                    <div class="controls">					
												<input type="text" class="span12 m-wrap c-alias" autocomplete="off" name="Goods[alias]"  placeholder="请输入别名">
											</div>	
		                                  </div>
		                                </div>
		                              </div>
		                              <div class="row-fluid clearfix">
		                                <div class="span12">
		                                  <div class="control-group">
		                                    <label class="control-label">分子结构：</label>
		                                    <div class="controls uploader j-moleupload">
												<script type="text/plain" id="upload_ue"></script>
								                <input type="text" style="width:450px;" class="span3 c-yiupfile filename w-weiuper j-weiuper" name="Goods[structure]" id="picture"/>
												<a href="javascript:void(0);" onclick="upImage(this);">上传图片</a>
												<img id="preview" src="" alt="" style="width:40px;height:40px;">
											</div>
		                                  </div>
		                                </div>
		                              </div>
		                            </div>
		                          </div>
		                          <!--end--> 
		                        </div>
		                      </div>
		                      <!--end--> 
		                      <!--物化性质-->
		                      <div class="detail-item-left weipin-mrgt">
		                        <ul class="breadcrumb clearfix">
		                          <li><a href="javascript:;">物化性质</a></li>
		                        </ul>
		                        <div class="detal-form form-horizontal"> 
		                          <!--start-->
		                          <div class="row-fluid clearfix">
		                            <div class="span10"> 
		                              <!--st-->
		                              <div class="row-fluid clearfix">
		                                <div class="span4">
		                                  <div class="control-group">
		                                    <label class="control-label">外观及形状：</label>
		                                    <div class="controls">					
												<input type="text" class="span12 m-wrap c-outsidit" autocomplete="off" name="Goods[shape]"  placeholder="请输入外观及形状">
											</div>	
		                                  </div>
		                                </div>
		                                <div class="span4">
		                                  <div class="control-group">
		                                    <label class="control-label">密度：</label>
		                                    <div class="controls">					
												<input type="text" class="span12 m-wrap c-density" autocomplete="off" name="Goods[density]"  placeholder="请输入密度">
											</div>	
		                                  </div>
		                                </div>
		                                <div class="span4">
		                                  <div class="control-group">
		                                    <label class="control-label">熔点：</label>
		                                    <div class="controls">					
												<input type="text" class="span12 m-wrap c-fusingpt" autocomplete="off" name="Goods[melting_point]"  placeholder="请输入熔点">
											</div>	
		                                  </div>
		                                </div>
		                              </div>
		                            
		                              <div class="row-fluid clearfix">
		                                <div class="span4">
		                                  <div class="control-group">
		                                    <label class="control-label">沸点：</label>
		                                    <div class="controls">					
												<input type="text" class="span12 m-wrap c-boliing" autocomplete="off" name="Goods[point]"  placeholder="请输入沸点">
											</div>	
		                                  </div>
		                                </div>
		                                <div class="span4">
		                                  <div class="control-group">
		                                    <label class="control-label">闪点：</label>
		                                    <div class="controls">					
												<input type="text" class="span12 m-wrap c-starpt" autocomplete="off" name="Goods[flash]"  placeholder="请输入闪点">
											</div>	
		                                  </div>
		                                </div>
		                                <div class="span4">
		                                  <div class="control-group">
		                                    <label class="control-label">折射率：</label>
		                                    <div class="controls">					
												<input type="text" class="span12 m-wrap c-refract" autocomplete="off" name="Goods[refraction]"  placeholder="请输入折射率">
											</div>	
		                                  </div>
		                                </div>
		                              </div>
		                              
		                              <div class="row-fluid clearfix">
		                                <div class="span4">
		                                  <div class="control-group">
		                                    <label class="control-label">水溶解性：</label>
		                                    <div class="controls">					
												<input type="text" class="span12 m-wrap c-watersolu" autocomplete="off" name="Goods[water]"  placeholder="请输入水溶解性">
											</div>	
		                                  </div>
		                                </div>
		                                <div class="span4">
		                                  <div class="control-group">
		                                    <label class="control-label">稳定性：</label>
		                                    <div class="controls">					
												<input type="text" class="span12 m-wrap c-stabity" autocomplete="off" name="Goods[stability]"   placeholder="请输入稳定性">
											</div>	
		                                  </div>
		                                </div>
		                                <div class="span4">
		                                  <div class="control-group">
		                                    <label class="control-label">储存条件：</label>
		                                    <div class="controls">					
												<input type="text" class="span12 m-wrap c-storage" autocomplete="off" name="Goods[storage]"  placeholder="请输入储存条件">
											</div>	
		                                  </div>
		                                </div>
		                              </div>
		                              <div class="row-fluid clearfix">
		                                <div class="span4">
		                                  <div class="control-group">
		                                    <label class="control-label">蒸气压：</label>
		                                    <div class="controls">					
												<input type="text" class="span12 m-wrap c-tension" autocomplete="off" name="Goods[vapour]"  placeholder="请输入蒸气压">
											</div>		
		                                  </div>
		                                </div>
		                              </div>
		                            </div>
		                          </div>
		                          <!--end--> 
		                        </div>
		                      </div>
		                      
		                      <!--安全信息-->
		                      <div class="detail-item-left weipin-mrgt">
		                        <ul class="breadcrumb clearfix">
		                          <li><a href="javascript:;">安全信息</a></li>
		                        </ul>
		                        <div class="detal-form form-horizontal"> 
		                          <!--start-->
		                          <div class="row-fluid clearfix">
		                            <div class="span10"> 
		                            	
		                              <div class="row-fluid clearfix">
		                                <div class="span12">
		                                  <div class="control-group">
		                                    <label class="control-label">符号：</label>
		                                    <div class="controls uploader j-moleupload">
												<script type="text/plain" class="upload_ue"></script>
												<input type="text" style="width:450px;" class="span3 c-yiupfile filename w-weiuper j-weiuper" name="Goods[symbol]" id="pictures"/>
												<a href="javascript:void(0);" onclick="upImage(this);">上传图片</a>
												<img id="previews" src="" alt="" style="width:40px;height:40px;">
											</div>	
		                                  </div>
		                                </div>
		                              </div>
		                              <div class="row-fluid clearfix">
		                                <div class="span4">
		                                  <div class="control-group">
		                                    <label class="control-label">风险术语：</label>
		                                    <div class="controls">					
												<input type="text" class="span12 m-wrap c-dangerlag" autocomplete="off" name="Goods[risk]"  placeholder="请输入风险术语">
											</div>	
		                                  </div>
		                                </div>
		                              </div>
		                              <div class="row-fluid clearfix">
		                                <div class="span4">
		                                  <div class="control-group">
		                                    <label class="control-label">安全术语：</label>
		                                    <div class="controls">					
												<input type="text" class="span12 m-wrap c-safelag" autocomplete="off" name="Goods[security]"  placeholder="请输入安全术语">
											</div>	
		                                  </div>
		                                </div>
		                              </div>
		                            </div>
		                          </div>
		                          <!--end--> 
		                        </div>
		                      </div>
		                      <!--用途-->
		                      <div class="detail-item-left weipin-mrgt">
		                        <ul class="breadcrumb">
		                          <li><a href="javascript:;">用途</a></li>
		                        </ul>
		                        <div class="detal-form form-horizontal"> 
		                          <!--start-->
		                          <div class="row-fluid clearfix">
		                            <div class="span10"> 
		                            	
		                              <div class="row-fluid clearfix">
		                                <div class="span4">
		                                  <div class="control-group">
		                                    <label class="control-label">用途：</label>
		                                    <div class="controls">					
												<input type="text" class="span12 m-wrap c-purpose" autocomplete="off" name="Goods[purpose]"  placeholder="请输入用途">
											</div>	
		                                  </div>
		                                </div>
		                              </div>
		                            </div>
		                          </div>
		                        </div>
		                      </div>
		                      
		                      <!--上游原料-->
		                      <div class="detail-item-left weipin-mrgt">
		                      	<ul class="breadcrumb">
		                          <li><a href="javascript:;">上游原料</a></li>
		                        </ul>
		                        <div class="control-group">
									<div class="row-fluid">
										<div class="span12">	
											<!-- BEGIN EXAMPLE TABLE PORTLET-->
											<div class="portlet box light-grey" style="width: 98%; margin: 0 auto;">	
												<div class="portlet-body">	
													<div class="clearfix">	
														<div class="btn-group">	
															<a href="javascript:;" id="sample_allProd" class="btn btn-success">
															新增商品
															</a>
														</div>
														<div class="btn-group">	
															<a href="javascript:;" id="sample_delpro" class="btn btn-default">
															删除
															</a>
														</div>											
													</div>
													<div class="ordertball table-responsive">
													    <table class="table table-bordered tablelist" id="dataTableDetail">
										                    <thead class="tbhead tup_head">
											                    <tr>	
											                    	<th width="28">
											                    		<label class="lbmargin">
															    			<input type="checkbox"class="checkson upproAllImg" />
															    			<img src="{{URL::asset('static/images/c_checkbox_off.png')}}"/>
															    		</label>
											                    	</th>
											                        <th class="t1">
											                        	<p>序号</p>
											                        </th>
																	<th class="t1">
																		<p>商品ID</p>
																	</th>
											                         <th class="t1">
											                        	<p>库存编码</p>
											                        </th>
											                        <th class="t1">
											                        	<p>商品名称</p>
											                        </th>
											                        <th class="t1">
											                        	<p>CAS号</p>
											                        </th>

											                    </tr>
										                    </thead>
										                    <tbody class="tbbody tup_body" id="addertr_up">

										                    </tbody>
										               </table>
													</div>
												</div>	
											</div>	
											<!-- END EXAMPLE TABLE PORTLET-->	
										</div>
									</div>
								</div>														
		                      </div>
		                    	<!--下游原料-->
		                      <div class="detail-item-left weipin-mrgt">
		                      	<ul class="breadcrumb">
		                          <li><a href="javascript:;">下游原料</a></li>
		                        </ul>
		                        <div class="control-group">
									<div class="row-fluid">
										<div class="span12">	
											<!-- BEGIN EXAMPLE TABLE PORTLET-->
											<div class="portlet box light-grey" style="width: 98%; margin: 0 auto;">	
												<div class="portlet-body">	
													<div class="clearfix">	
														<div class="btn-group">	
															<a href="javascript:;" id="sampled_downLowerAdd" class="btn btn-success">
															新增商品
															</a>
														</div>
														<div class="btn-group">	
															<a href="javascript:;" id="sample_downLowerDel" class="btn btn-default">
															删除
															</a>
														</div>											
													</div>
													<div class="ordertball table-responsive">
													    <table class="table table-bordered tablelist" id="dataTableDetail">
										                    <thead class="tbhead tdown_head ">
											                    <tr>	
											                    	<th width="28">
											                    		<label class="lbmargin">
															    			<input type="checkbox"class="checkson downLowerAllImg" />								
															    			<img src="{{URL::asset('static/images/c_checkbox_off.png')}}"/>
															    		</label>
											                    	</th>
											                        <th class="t1">
											                        	<p>序号</p>
											                        </th>
											                         <th class="t1">
											                        	<p>商品ID</p>
											                        </th>
																	<th class="t1">
																		<p>库存编码</p>
																	</th>
																	<th class="t1">
											                        	<p>商品名称</p>
											                        </th>

											                        <th class="t1">
											                        	<p>CAS号</p>
											                        </th>											                       
											                    </tr>
										                    </thead>
										                    <tbody class="tbbody tdown_body" id="addertr_down">
											                    {{--<tr>--}}
											                    	{{--<td class="linhigh">					                    		--}}
											                    		{{--<label class="lbmargin">--}}
															    			{{--<input type="checkbox" class="checkson checkbox_child"/>							--}}
															    			{{--<img src="{{URL::asset('static/images/c_checkbox_off.png')}}"/>--}}
															    		{{--</label>--}}
																	{{--</td>--}}
											                        {{--<td class="linhigh">1</td>--}}
											                        {{--<td class="linhigh">2280130305701</td>--}}
											                         {{--<td class="linhigh">(易制毒三类）2-丁酮，不销售，>95%</td>--}}
											                        {{--<td class="linhigh">CATO</td>--}}
											                  										                        {{----}}
											                    {{--</tr>--}}

										                    </tbody>
										               </table>
													</div>
												</div>	
											</div>	
											<!-- END EXAMPLE TABLE PORTLET-->	
										</div>
									</div>
								</div>														
		                      </div>
		                    
		                    </div>
		                    
		                </div>
		                <div class="form-actions">			
							<button type="button" id="submit" class="btn green j-addweipro">添加</button>
							<button type="reset" class="btn">重置</button>			
						</div>
                	</form>
                  
                </div>
                <!-- END VALIDATION STATES--> 
              </div>
            </div>
            <!--end tab-pane--> 
          </div>
        </div>
        <!--end tabbable--> 
      </div>
    </div>
  </div>
</div>

<!--添加商品 弹窗-->
<div class="modelhist j-mproChoose hide">
	<div class="row-fluid clearfix">
		<div class="span4">
			<div class="zTreeDemoBackground">
				<ul id="treeDemo" class="ztree"></ul>
			</div>
		</div>

		<div class="span8">
			<div class="showd" id="j-showdPro">
				<div class="row-fluid clearfix">
					<div class="span12">
						<div class="portlet-body margin-right-15">
							<div class="ordertball table-responsive margin-bottom-20  greyground">
								<div class="protitle clearfix">
									<div class="proleft pull-left"> 全部商品</div>
									<div class="proright pull-right">
										<form class="formsearch">
											<div class="inputbox">
												<input type="text" placeholder="Search..." class="j-serchput">
												<input type="button" class="subseach" id="j-subSeachBtn" value=" ">
											</div>
										</form>
									</div>
								</div>
								<div class="protable">
									<table class="table table-bordered tablelist" id="serchTable" style="background: #fff;">
										<thead class="prot_head">
										<tr class="hedtr">
											<th>
												<label class="model_laber">
													<input type="checkbox" class="checkson protCheckAll" />
													<img src="{{URL::asset('/static/images/c_checkbox_off.png')}}"/>
												</label>
											</th>

											<th class="t1">
												<p>商品ID</p>
											</th>
											<th class="t1">
												<p>商品名称</p>
											</th>

										</tr>
										</thead>
										<tbody class="prot_body" id="layerDown">

										@foreach($goods as $k=>$v)
										<tr >
											<td>
												<label class="model_laber">
													<input type="checkbox"  data-id ="{{$v->goods_id}}" class="checkson"/>
													<img src="{{URL::asset('/static/images/c_checkbox_off.png')}}"/>
												</label>
											</td>

											<td>{{$v->goods_id}}</td>
											<td>{{$v->goods_name}}</td>

										</tr>
											@endforeach

										</tbody>

									</table>
								</div>
							</div>
							<!--已选商品-->
							<div class="ordertball table-responsive margin-bottom-20 greyground">
								<div class="protitle clearfix">
									<div class="proleft pull-left"> 已选商品</div>
									{{--<div class="proright pull-right">--}}
										{{--<a href="javascript:" class="btn btn-danger j-choosedpro">删除</a>--}}
									{{--</div>--}}
								</div>
								<div class="protable">
									<table class="table table-bordered tablelist newList" style="background: #fff;">
										<thead class="choosed_head">
										<tr>

											<th class="t1">
												<p>商品ID</p>
											</th>

											<th class="t1">
												<p>商品名称</p>
											</th>

										</tr>
										</thead>
										<tbody class="choosed_body">

										</tbody>
									</table>
								</div>
							</div>
						</div>
					</div>
				</div>
			</div>

		</div>
	</div>

</div>
<!-- footer -->
<div class="footer">
  <div class="footer-inner"> Copyright &copy; 开单管理   沪ICP备16047540号-1</div>
  <div class="footer-tools"> <span class="go-top"> <i class="icon-angle-up"></i> </span> </div>
</div>
<link  type="text/css" href="{{URL::asset('static/style/public/layui.css')}}" rel="stylesheet" />
<script src="{{URL::asset('static/js/public/layui.js')}}" charset="utf-8"></script>
<script type="text/javascript" src="{{URL::asset('static/js/public/app.js')}}"></script>
<script type="text/javascript" src="{{URL::asset('static/js/public/layer.js')}}"></script>
<link  type="text/css" href="{{URL::asset('static/style/public/layer.css')}}" rel="stylesheet" />
<script type="text/javascript" src="{{URL::asset('static/js/public/flow.js')}}"></script>

<link href="{{URL::asset('static/style/lib/yy_buesslicence.css')}}" rel="stylesheet" type="text/css">

{{--ueditor--}}

<!-- 配置文件 -->
<script type="text/javascript" src="{{URL::asset('ueditor/ueditor.config.js')}}"></script>
<!-- 编辑器源码文件 -->
<script type="text/javascript" src="{{URL::asset('ueditor/ueditor.all.js')}}"></script>
<script type="text/javascript" src="{{URL::asset('ueditor/ueditor.all.min.js')}}"></script>

<!--tree-->
<script type="text/javascript" src="{{URL::asset('static/js/public/jquery.ztree.core.js')}}"></script>
<link type="text/css" rel="stylesheet" href="{{URL::asset('static/style/public/zTreeStyle.css')}}" />
<!--single-->
<script type="text/javascript" src="{{URL::asset('static/js/lib/model-treelist.js')}}"></script>
<link  type="text/css" rel="stylesheet" href="{{URL::asset('static/style/lib/model-treelist.css')}}" />
<script type="text/javascript" src="{{URL::asset('static/js/lib/wei_addpro.js')}}"></script>
<script>
	jQuery(document).ready(function() {
	   // initiate layout and plugins
	   App.init();
	});

</script>

<script type="text/javascript">

    var _editor = UE.getEditor('upload_ue');
    var jack;
    _editor.ready(function () {
        //设置编辑器不可用
        _editor.setDisabled('insertimage');
        //隐藏编辑器，因为不会用到这个编辑器实例，所以要隐藏
        _editor.hide();
        //侦听图片上传
        _editor.addListener('beforeInsertImage', function (t, arg) {
            //将地址赋值给相应的input,只去第一张图片的路径
            $(jack).parent('div').find('input').attr('value', arg[0].src);
            // $(".picture").attr("value", arg[0].src);
            //图片预览
            $(jack).parent('div').find('img').attr('src', arg[0].src);
            // $(".preview").attr("src", arg[0].src);
        })
        //侦听文件上传，取上传文件列表中第一个上传的文件的路径
        _editor.addListener('afterUpfile', function (t, arg) {

            $("#file").attr("value", arg[0].url);

        })
    });
    //弹出图片上传的对话框
    function upImage(mydiv) {
        jack = mydiv;
        var myImage = _editor.getDialog("insertimage");
        myImage.open();
    }
    //弹出文件上传的对话框
    function upFiles() {
        var myFiles = _editor.getDialog("attachment");
        myFiles.open();
    }

</script>
<script>
    layui.use('flow', function(){
        var $ = layui.jquery; //不用额外加载jQuery，flow模块本身是有依赖jQuery的，直接用即可。
        var flow = layui.flow;
        flow.load({
            elem: '#layerDown' //指定列表容器
            ,done: function(page, next){ //到达临界点（默认滚动触发），触发下一页
                var lis = [];
                //以jQuery的Ajax请求为例，请求下一页数据（注意：page是从2开始返回）
                $.get('/dangerous/dangerous/location?page='+page, function(res){
                    //假设你的列表返回在data集合中

                    console.log(res)
                    layui.each(res.data, function(index, item){
                        // lis.push('<li>'+ item.title +'</li>');
                        lis.push('<tr><td><label class="model_laber"><input type="checkbox"  data-id ="'+item.goods_id+'" class="checkson"/><img src="/static/images/c_checkbox_off.png"/></label></td><td>'+item.goods_id+'</td><td>'+item.goods_name+'</td></tr>');
                    });

                    //执行下一页渲染，第二参数为：满足“加载更多”的条件，即后面仍有分页
                    //pages为Ajax返回的总页数，只有当前页小于总页数的情况下，才会继续出现加载更多
                    next(lis.join(''), page < res.pages);
                });
            }
        });
    });
</script>

</body>
</html>